<%@page import="cn.sdhuijin.vms.model.Organization,java.util.List"%>
<%@ page language="java" contentType="text/json; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%!String printTree(Organization org) {
		StringBuffer sb = new StringBuffer("{\"id\":\"");
		sb.append(org.getId().toString()).append("\",\"text\":\"")
				.append(org.getName()).append("\"");
		List<Organization> children=org.getChildren();
		if (!children.isEmpty()) {
			sb.append(",\"children\":[");
			
			for(Organization o:children){
				sb.append(printTree(o));
			}
			sb.append("]");
		} 
		sb.append("},");
		String str=sb.toString().replaceAll(",]","]");
		return str;
	}%>
	[
<%
	Organization org = (Organization) request.getAttribute("org");
	String str=printTree(org).toString();
	str=str.substring(0,str.length()-1);
	out.print(str);
%>]